﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.Storage;
using Windows.Storage.Pickers;
using WinRT.Interop;

namespace CustomPixelShaderEffect.UlitFolder
{
    public static class Ulit
    {
        public static IntPtr WindowHandle { get; private set; }

        public static void SetWindowHandle(object window)
        {
            WindowHandle = WindowNative.GetWindowHandle(window);
        }

        public static void SetHandle(object obj)
        {
            InitializeWithWindow.Initialize(obj, WindowHandle);
        }

        public static async Task<StorageFile> SelectFileAsync(IList<string> fileTypeFilter)
        {
            FileOpenPicker picker = new FileOpenPicker();
            foreach (var item in fileTypeFilter)
                picker.FileTypeFilter.Add(item);
            SetHandle(picker);

            var file = await picker.PickSingleFileAsync();
            return file;
        }

    }
}
